package cn.pzhu.java.ch04.collectiondemo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class SimpleCollectionDemo {

	public static void main(String[] args) {
		Collection c=new ArrayList();// create collection
		//add element
		c.add("JAVA");
		c.add("C#");
		c.add("C++");
		
		//read
	/*	for(Object obj:c){
			String s=(String)obj;
			System.out.println(s);
		}*/
		
		Iterator it=c.iterator();
		while(it.hasNext()){
			Object obj=it.next();
			String s=(String)obj;
			System.out.println(s);
		}
	}

}
